<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vuejs/velocity.js"></script>
    <script src="./vuejs/vue.js"></script>
</head>
<body>
    <div id="app">
        <input type="text" placeholder="请输入要查找的内容" v-model="query">
        <fade : query="query" : item="items">
            <li v-for="(item,index) in ComputedList" :key="item.msg" :data-index="index">
                {{item.msg}}
            </li>
        </fade>
    </div>
    <template id="temp">
        <transition-group name="item" tag="ul" @before-enter="beforeEnter" @enter="enter" @leave="leave"
        v-bind:css="false">
        <slot></slot>
        </transition-group>
    </template>
    <script>
        Vue.component('fade',{
            props:['query','items'],
            template:'#temp',
            methods: {
                beforeEnter(el) {
                    el.style.opcity = 0
                    el.style.height = 0
                },
                enter(el, done) {
                    var delay = el.dataset.index * 150
                    setTimeout(function () {
                        Velocity(el, { opcity: 0, height: '1.6em' }, { complete: done })
                    }, delay)
                },
                leave(el, done) {
                    var delay = el.dataset.index * 150
                    setTimeout(function () {
                        Velocity(el, { opcity: 0, height: 0 }, { complete: done })
                    }, delay)
                }
            }
            
    </script>
</body>
</html>